package org.bigk.invoices.exceptions;

import java.sql.SQLException;

public class DBAccessException extends Exception {

	private static final long serialVersionUID = 4134159135606290451L;
	
	private String errorCode;
	private Object[] errorCodeParams;
	
	public DBAccessException() {
		super();
	}

	public DBAccessException(String message, Throwable cause) {
		super(message, cause);
	}

	public DBAccessException(String message) {
		super(message);
	}

	public DBAccessException(Throwable cause) {
		super(cause);
	}

	public DBAccessException(String message, String errorCode, Object[] errorCodeParams) {
		super(message);
		this.errorCode = errorCode;
		this.errorCodeParams = errorCodeParams;
	}

	public DBAccessException(String message, String errorCode) {
		super(message);
		this.errorCode = errorCode;
	}

	public DBAccessException(String message, Throwable cause, String errorCode,
			Object[] errorCodeParams) {
		super(message, cause);
		this.errorCode = errorCode;
		this.errorCodeParams = errorCodeParams;
	}

	public DBAccessException(String message, Throwable cause, String errorCode) {
		super(message, cause);
		this.errorCode = errorCode;
	}

	public DBAccessException(SQLException cause) {
		super(cause.getMessage(), cause);
		this.setErrorCode("exceptions.DBAccessException_1Param");
		this.setErrorCodeParams(new Object[] {cause.getMessage()});
	}

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public Object[] getErrorCodeParams() {
		return errorCodeParams;
	}

	public void setErrorCodeParams(Object[] errorCodeParams) {
		this.errorCodeParams = errorCodeParams;
	}
}
